package com.fyy.minio.sdxt;

import okhttp3.*;
import java.io.IOException;

public class PicSendApiTest {

    public final static String PICURL = "http://218.28.165.197:18091/zhxl/img/visu/getPatrol?id=63467c464df91940c0ac0086";
    public final static String PICURL2 = "http://123.13.218.244:86/ftp_admin/20221012/1002000100000000000000000074100/20221012170104_001.jpg";
    public final static String URI = "http://124.133.246.142:20013/picanalyse";

    public static void main(String[] args) throws IOException {
        OkHttpClient client = new OkHttpClient().newBuilder().build();
        MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
        StringBuilder s = new StringBuilder();
        s.append("meid=86296804");
        s.append("&");
        s.append("picname=20221012100112333333_001.jpg");
        s.append("&");
        s.append("applicationip=110.42.242.119");
        s.append("&");
        s.append("applicationport=18435");
        s.append("&");
        //s.append("localurl=" + PICURL);
        s.append("localurl=" + PICURL2);
        s.append("&");
        s.append("version=2.0");
        RequestBody body = RequestBody.create(mediaType,s.toString());
        Request request = new Request.Builder()
                .url(URI)
                .method("POST",body)
                .addHeader("Content-Type","application/x-www-form-urlencoded")
                .build();
        Response response = client.newCall(request).execute();
        System.out.println("请求结果：" + response.code());
        if(response.isSuccessful()){
            String result = response.body().string();
            System.out.println(result);
        }
    }

}
